/***************************************************************************
                                                                             
RRRRRRRRRRRRRRRRR                                              999999999     
R::::::::::::::::R                                           99:::::::::99   
R::::::RRRRRR:::::R                                        99:::::::::::::99 
RR:::::R     R:::::R                                      9::::::99999::::::9
  R::::R     R:::::R    eeeeeeeeeeee  xxxxxxx      xxxxxxx9:::::9     9:::::9
  R::::R     R:::::R  ee::::::::::::ee x:::::x    x:::::x 9:::::9     9:::::9
  R::::RRRRRR:::::R  e::::::eeeee:::::eex:::::x  x:::::x   9:::::99999::::::9
  R:::::::::::::RR  e::::::e     e:::::e x:::::xx:::::x     99::::::::::::::9
  R::::RRRRRR:::::R e:::::::eeeee::::::e  x::::::::::x        99999::::::::9 
  R::::R     R:::::Re:::::::::::::::::e    x::::::::x              9::::::9  
  R::::R     R:::::Re::::::eeeeeeeeeee     x::::::::x             9::::::9   
  R::::R     R:::::Re:::::::e             x::::::::::x           9::::::9    
RR:::::R     R:::::Re::::::::e           x:::::xx:::::x         9::::::9     
R::::::R     R:::::R e::::::::eeeeeeee  x:::::x  x:::::x       9::::::9      
R::::::R     R:::::R  ee:::::::::::::e x:::::x    x:::::x     9::::::9       
RRRRRRRR     RRRRRRR    eeeeeeeeeeeeeexxxxxxx      xxxxxxx   99999999        

 * 文件名：st7735.h
 * 版本号：V1.0
 * 作者: rex9
 * 生成日期：Dec 30, 2020
 * 最近修改：
 * 功能描诉：
 * 说明：TFT LCD的使用，驱动芯片为ST7735
 * STM32CubeMX配置SPI1
 * SPI1_TX DMA1 Channel 3
 * 使能所有中断
 *
 * 模块引脚：
 * VCC：电源
 * GND：地
 * SCK：PA5
 * SDI：PA7
 * RS：PB0
 * RST：PB1
 * CS：PB10
 * BLK：PB11
 *
 ***************************************************************************
 */

#ifndef INC_ST7735_H_
#define INC_ST7735_H_

#include <stdint.h>

//IO定义
#define SPI_CS_LOW		HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_RESET)
#define SPI_CS_HIGH		HAL_GPIO_WritePin(SPI_CS_GPIO_Port, SPI_CS_Pin, GPIO_PIN_SET)
#define SPI_RS_LOW		HAL_GPIO_WritePin(SPI_RS_GPIO_Port, SPI_RS_Pin, GPIO_PIN_RESET)
#define SPI_RS_HIGH		HAL_GPIO_WritePin(SPI_RS_GPIO_Port, SPI_RS_Pin, GPIO_PIN_SET)
#define SPI_RST_LOW		HAL_GPIO_WritePin(SPI_RST_GPIO_Port, SPI_RST_Pin, GPIO_PIN_RESET)
#define SPI_RST_HIGH	HAL_GPIO_WritePin(SPI_RST_GPIO_Port, SPI_RST_Pin, GPIO_PIN_SET)
#define LCD_BLK_OFF		HAL_GPIO_WritePin(LCD_BLK_GPIO_Port, LCD_BLK_Pin, GPIO_PIN_RESET)
#define LCD_BLK_ON		HAL_GPIO_WritePin(LCD_BLK_GPIO_Port, LCD_BLK_Pin, GPIO_PIN_SET)
//分辨率
#define X_MAX_PIXEL		128
#define Y_MAX_PIXEL		128
#define PIXEL_NUMBER	128*128*2
//颜色代码
#define	RED 	0xf800
#define GREEN 	0x07e0
#define	BLUE 	0x001f
#define	WHITE 	0xffff
#define	BLACK 	0x0000
#define	YELLOW 	0xffe0
#define	GRAY0 	0xef7d
#define	GRAY1 	0x8410
#define	GRAY2 	0x4208

void ST7735_Init(void);
void Show_LOGO(void);
void Show_WAVE(uint8_t* p,uint16_t num);

#endif /* INC_ST7735_H_ */
